package com.travelgroup.config;

import com.alipay.easysdk.kernel.Config;
import com.travelgroup.config.property.AliProperty;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
public class AliPayConfig {

    @Bean
    public Config config(AliProperty aliProperty) {
        Config config = new Config();
        config.protocol = aliProperty.getProtocol();
        config.appId = aliProperty.getAppId();
        config.gatewayHost = aliProperty.getGatewayHost();
        config.signType = aliProperty.getSignType();
        config.alipayPublicKey = aliProperty.getAlipayPublicKey();
        config.merchantPrivateKey = aliProperty.getMerchantPrivateKey();
        config.notifyUrl = aliProperty.getNotifyUrl();
        config.encryptKey = "";
        return config;
    }
}
